package com.sinog.front.feign.biz;

import com.sinog.core.model.UploadAppendixFile;
import com.sinog.core.utilbean.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Map;

/**
 * @desc 提供ftpUtilService去biz中获取
 * @author wangxj
 * @date 2021/12/6 15:41
 */
@FeignClient("sinog2c-biz")
public interface  FtpUtilService {

    /**
     * 获取ftpClient信息
     * @return Map<String,String>
     */
    @PostMapping("/ftp/path/getFtpClient")
    Map<String,String> getFtpClient();

    /**
     * 从ftp判断文件是否存在
     * @param uploadAppendixFile uploadAppendixFile
     * @param type type
     * @return int
     */
    @RequestMapping("/ftp/path/fileIsExistence")
    int fileIsExistence(@RequestBody UploadAppendixFile uploadAppendixFile,@RequestParam("type") String type);

    /**
     * 从ftp下载文件到本地
     * @param realPath realPath
     * @param filepath filepath
     */
    @RequestMapping("/ftp/path/downLoadFromFtp")
    void downLoadFromFtp(@RequestParam("realPath") String realPath,@RequestParam("filepath") String filepath);

    /**
     * 异步上传ftp
     * @param datapath datapath
     * @param filePath filePath
     */
    @RequestMapping("/ftp/path/uploadFileToFtp")
    void uploadFileToFtp(@RequestParam("datapath") String datapath,@RequestParam("filePath") String filePath);

    /**
     * 上传文件到司法部 ftp服务器中
     * @param originalFilename 原文件名称
     * @param originalFilePath 原文件目录
     * @param desc desc
     * @return Result
     */
    @RequestMapping("/ftp/path/uploadFileToFtpRemote")
    Result uploadFileToFtpRemote(@RequestParam("originalFilename") String originalFilename,@RequestParam("originalFilePath") String originalFilePath,@RequestParam("desc")String desc);

    /**
     * 描述
     * @param request request
     * @param response response
     * @throws IOException
     */
    @RequestMapping("/azbj/spgl/download")
    void showVideo(@RequestParam("request")HttpServletRequest request,@RequestParam("response")HttpServletResponse response) throws IOException;

    /**
     * 从FTP服务器某目录下载文件
     * ftppath：FTP服务器主目录的相对目录	如：\aaa
     * fileName：要下载的文件名			如：\abc.zip
     * localDirPath：下载后要保存的目录	如：D:\tt
     * @param uploadAppendixFile uploadAppendixFile
     * @param path path
     * @param sfbdatapath sfbdatapath
     */
    @RequestMapping("/ftp/path/downLoadFromFtp3")
    void downLoadFromFtp3(
            @RequestBody UploadAppendixFile uploadAppendixFile,
            @RequestParam("path") String path,@RequestParam("sfbdatapath") String sfbdatapath);

    /**
     * 填写信息
     * @param s s
     * @param fileUrl fileUrl
     */
    @RequestMapping("/ftp/path/downLoadFromFtp5")
    void downLoadFromFtp5(@RequestParam("s") String s,@RequestParam("fileUrl") String fileUrl);

    /**
     * 下载文件重载6
     * @param fileJson fileJson
     * @param path path
     * @param datapath datapath
     * @return String
     */
    @RequestMapping("/ftp/path/downLoadFromFtp6")
    String downLoadFromFtp6(
            @RequestParam("fileJson") String fileJson,
            @RequestParam("path") String path,@RequestParam("datapath") String datapath);

    /**
     * 填写信息
     * @param path path
     * @param realPath realPath
     * @param pathTemp pathTemp
     * @return File
     */
    @RequestMapping("/ftp/path/uploadFileToFtp7")
    File uploadFileToFtp7(
            @RequestParam("path") String path,
            @RequestParam("realPath") String realPath,@RequestParam("pathTemp") String pathTemp);

    /**
     * 系统支持，文件查看和下载（视频）
     * @param sfbDataPath 远程文件夹路径
     * @param fileName 视频名称
     */
    @RequestMapping("/azbj/spgl/download")
    void downLoadFromVideo(@RequestParam("sfbDataPath") String sfbDataPath,@RequestParam("fileName") String fileName);

    /**
     * 查看培训文件
     * @param flag
     * @return
     */
    @GetMapping("/azbj/spgl/getAllVideos")
    String selectAllVideos(@RequestParam("flag") String flag);

    /**
     * 更改文件状态
     * @param name 文件名称
     * @param status 状态 0：上架 1：下架
     * @return Result
     */
    @RequestMapping("/azbj/spgl/updateVideos")
    Result updateVideo(@RequestParam("name")String name,@RequestParam("status")String status);

    /**
     * 删除本地文件
     * @param uploadFilePathName 文件全路径
     * @param originalFilename 文件名称
     * @return  Result
     */
    @RequestMapping("/azbj/spgl/deleteLocal")
    Result delete(@RequestParam("uploadFilePathName")String uploadFilePathName,@RequestParam("originalFilename")String originalFilename);

    /**
     * 文件从ftp下载
     * @param fileName 真实文件名称
     * @param realPath 文件全路径
     */
    @RequestMapping("/azbj/spgl/downFromFtp")
    void downLoadVideoFromFtp(@RequestParam("fileName") String fileName,@RequestParam("realPath") String realPath);
}